namespace QMVnSoft.SystemForms
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.IO;
    using System.Windows.Forms;

    public class FormCreateDatabase : FormControl
    {
        private BtnControl btnCancel;
        private BtnControl btnLocation;
        private BtnControl btnOk;
        private IContainer components;
        private GBoxControl gBoxInsertDEMOData;
        private GBoxControl gBoxPath;
        private bool ib_CheckAccepted;
        private string is_StringLocation;
        private LabelControl labelControl1;
        private RdioControl rdioControl1;
        private RdioControl rdioControl2;
        private TextControl txtLocation;

        public FormCreateDatabase()
        {
            this.InitializeComponent();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnLocation_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();
            //dialog.ShowNewFolderButton = true;            
            dialog.ShowDialog();
            this.txtLocation.Text = dialog.SelectedPath;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(this.txtLocation.Text))
            {
                MessageBox.Show("Đường dẫn dữ liệu không chính xác!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                this.CheckAccepted = true;
                this.StringLocation = this.txtLocation.Text;
                base.Close();
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            //ComponentResourceManager manager = new ComponentResourceManager(typeof(FormCreateDatabase));
            this.btnCancel = new BtnControl();
            this.btnOk = new BtnControl();
            this.txtLocation = new TextControl();
            this.btnLocation = new BtnControl();
            this.labelControl1 = new LabelControl();
            this.gBoxPath = new GBoxControl();
            this.gBoxInsertDEMOData = new GBoxControl();
            this.rdioControl2 = new RdioControl();
            this.rdioControl1 = new RdioControl();
            this.gBoxPath.SuspendLayout();
            this.gBoxInsertDEMOData.SuspendLayout();
            base.SuspendLayout();
            //this.btnCancel.DialogResult = DialogResult.Cancel;
            this.btnCancel.Font = new Font("Arial", 8.25f);
            this.btnCancel.Location = new Point(0xb3, 0xaf);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new Size(120, 0x17);
            this.btnCancel.TabIndex = 3;
            this.btnCancel.Text = "&Huỷ bỏ";
            this.btnCancel.UseVisualStyleBackColor = true;
            this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
            this.btnOk.Font = new Font("Arial", 8.25f);
            this.btnOk.Location = new Point(0x35, 0xaf);
            this.btnOk.Name = "btnOk";
            this.btnOk.Size = new Size(120, 0x17);
            this.btnOk.TabIndex = 2;
            this.btnOk.Text = "&Thực hiện";
            this.btnOk.UseVisualStyleBackColor = true;
            this.btnOk.Click += new EventHandler(this.btnOk_Click);
            this.txtLocation.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtLocation.CheckTextSearched = false;
            this.txtLocation.DisabledForeColor = Color.Blue;
            this.txtLocation.Font = new Font("Arial", 8.25f);
            this.txtLocation.Location = new Point(6, 0x1b);
            this.txtLocation.Name = "txtLocation";
            this.txtLocation.OldValue = null;
            this.txtLocation.Size = new Size(0x117, 20);
            this.txtLocation.TabIndex = 0;
//            //this.txtLocation.Value = null;//manager.GetObject("txtLocation.Value");
            this.btnLocation.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.btnLocation.Font = new Font("Arial", 8.25f);
            this.btnLocation.Location = new Point(0x123, 0x19);
            this.btnLocation.Name = "btnLocation";
            this.btnLocation.Size = new Size(30, 0x16);
            this.btnLocation.TabIndex = 1;
            this.btnLocation.Text = "...";
            this.btnLocation.UseVisualStyleBackColor = true;
            this.btnLocation.Click += new EventHandler(this.btnLocation_Click);
            this.labelControl1.BorderStyle = BorderStyle.Fixed3D;
            this.labelControl1.Font = new Font("Arial", 8.25f);
            this.labelControl1.Location = new Point(15, 0x9d);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new Size(0x146, 2);
            this.labelControl1.TabIndex = 10;
            this.gBoxPath.Controls.Add(this.txtLocation);
            this.gBoxPath.Controls.Add(this.btnLocation);
            this.gBoxPath.Font = new Font("Arial", 8.25f);
            this.gBoxPath.Location = new Point(12, 12);
            this.gBoxPath.Name = "gBoxPath";
            this.gBoxPath.Size = new Size(0x147, 0x42);
            this.gBoxPath.TabIndex = 0;
            this.gBoxPath.TabStop = false;
            this.gBoxPath.Text = "Đường dẫn dữ liệu";
            this.gBoxInsertDEMOData.Controls.Add(this.rdioControl2);
            this.gBoxInsertDEMOData.Controls.Add(this.rdioControl1);
            this.gBoxInsertDEMOData.Font = new Font("Arial", 8.25f);
            this.gBoxInsertDEMOData.Location = new Point(12, 0x54);
            this.gBoxInsertDEMOData.Name = "gBoxInsertDEMOData";
            this.gBoxInsertDEMOData.OptionBox = true;
            this.gBoxInsertDEMOData.Size = new Size(0x147, 0x42);
            this.gBoxInsertDEMOData.TabIndex = 1;
            this.gBoxInsertDEMOData.TabStop = false;
            this.gBoxInsertDEMOData.Text = "Cập nhật dữ liệu mẫu";
            this.rdioControl2.AutoSize = true;
            this.rdioControl2.Font = new Font("Arial", 8.25f);
            this.rdioControl2.Location = new Point(0xd3, 0x1d);
            this.rdioControl2.Name = "rdioControl2";
            this.rdioControl2.Size = new Size(0x26, 0x12);
            this.rdioControl2.TabIndex = 1;
            this.rdioControl2.Text = "C\x00f3";
            this.rdioControl2.UseVisualStyleBackColor = true;
            this.rdioControl1.AutoSize = true;
            this.rdioControl1.Checked = true;
            this.rdioControl1.Font = new Font("Arial", 8.25f);
            this.rdioControl1.Location = new Point(0x41, 0x1d);
            this.rdioControl1.Name = "rdioControl1";
            this.rdioControl1.Size = new Size(0x38, 0x12);
            this.rdioControl1.TabIndex = 0;
            this.rdioControl1.TabStop = true;
            this.rdioControl1.Text = "Không";
            this.rdioControl1.UseVisualStyleBackColor = true;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.CancelButton = this.btnCancel;
            base.ClientSize = new Size(0x161, 210);
            base.Controls.Add(this.gBoxInsertDEMOData);
            base.Controls.Add(this.gBoxPath);
            base.Controls.Add(this.labelControl1);
            base.Controls.Add(this.btnCancel);
            base.Controls.Add(this.btnOk);
            //base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "FormCreateDatabase";
            base.ShowInTaskbar = false;
            this.Text = "Đường dẫn lưu trữ cơ sở dữ liệu";
            this.gBoxPath.ResumeLayout(false);
            this.gBoxPath.PerformLayout();
            this.gBoxInsertDEMOData.ResumeLayout(false);
            this.gBoxInsertDEMOData.PerformLayout();
            base.ResumeLayout(false);
        }

        public bool CheckAccepted
        {
            get
            {
                return this.ib_CheckAccepted;
            }
            set
            {
                this.ib_CheckAccepted = value;
            }
        }

        public bool InsertDEMOData
        {
            get
            {
                return (this.gBoxInsertDEMOData.Value == 1);
            }
        }

        public string StringLocation
        {
            get
            {
                if (this.is_StringLocation.Substring(this.is_StringLocation.Length - 1) != @"\")
                {
                    return (this.is_StringLocation + @"\");
                }
                return this.is_StringLocation;
            }
            set
            {
                this.is_StringLocation = value;
            }
        }
    }
}

